Print a specified list after removing Nth elements¶
Print a specified list after removing the 0th, 4th and 5th elements.
Sample List:
[‘Red’, ‘Green’, ‘White’, ‘Black’, ‘Pink’, ‘Yellow’]
Output:
.. code-block:: py
color = [‘Red’, ‘Green’, ‘White’, ‘Black’, ‘Pink’, ‘Yellow’] color = [x for (i, x) in enumerate(color) if i not in (0, 4, 5)]
print(color)
Output:
['Green', 'White', 'Black']